#pragma once
#include "file_server.h"

struct PanoramaInfo
{
	string pano_name;
	string pano_full_path;
	int rows;
	int cols;
	int img_width;
	int img_height;
	std::time_t last_write_time;
};

typedef FileServerOption PanoFileServerOption;

class PanoramaFileServer :public FileServer {
public:


	PanoramaFileServer(PanoFileServerOption& option);

	void QueryServerFiles(evhttp_request* req) override;

	void QueryServerDirs(evhttp_request* req) override;

	void RenameServerFile(evhttp_request* req) override;

	void DeleteServerFile(evhttp_request* req) override;

protected:
	static int SearchPanoramaFiles(fs::path dir_path, unsigned int start, unsigned int limit, vector<PanoramaInfo>& pano_infos);

	static int SearchPanoramaDirs(fs::path dir_path, unsigned int start, unsigned int limit, vector<DirInfo>& dir_infos);

	static bool CheckPanoramaFile(fs::path file_path, PanoramaInfo* info);
};